Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent 500 when there is an error during new auth source post #19041

Merged

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Mar 9, 2022

Fix #19036

Signed-off-by: Andrew Thornton art27@cantab.net

Fix go-gitea#19036

Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 10, 2022
@lunny
Copy link
Member

lunny commented Mar 10, 2022

Have you checked all the places in that templates?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 10, 2022

There is another bug reported in #19036 (Error 1062: Duplicate entry 'aa' for key 'login_source.UQE_login_source_name)

Steps:

  1. Create login source "foo"
  2. Create login source "bar"
  3. Edit "bar", change the name to "foo", save
  4. Then 500 error occurs because duplicated unique key.

I didn't know what's the proper way to handle the duplicated key check in Gitea. Should it use a separate SELECT to check? Or does XORM provide some error check mechanism to detect the error is caused by duplicated unique key?

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 10, 2022
@6543
Copy link
Member

6543 commented Mar 10, 2022

👍

@6543 6543 merged commit a223bc8 into go-gitea:main Mar 10, 2022
@lunny
Copy link
Member

lunny commented Mar 11, 2022

There is another bug reported in #19036 (Error 1062: Duplicate entry 'aa' for key 'login_source.UQE_login_source_name)

Steps:

  1. Create login source "foo"
  2. Create login source "bar"
  3. Edit "bar", change the name to "foo", save
  4. Then 500 error occurs because duplicated unique key.

I didn't know what's the proper way to handle the duplicated key check in Gitea. Should it use a separate SELECT to check? Or does XORM provide some error check mechanism to detect the error is caused by duplicated unique key?

Please create a new issue.

zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 11, 2022
* giteaofficial/main:
  Prevent 500 when there is an error during new auth source post (go-gitea#19041)
  Update the webauthn_credential_id_sequence in Postgres (go-gitea#19048)
  If rendering has failed due to a net.OpError stop rendering (attempt 2) (go-gitea#19049)
  use xorm builder for models.getReviewers() (go-gitea#19033)
  RSS/Atom support for Orgs (go-gitea#17714)
  Fix flag validation (go-gitea#19046)
  Improve SyncMirrors logging (go-gitea#19045)
@zeripath zeripath deleted the fix-19036-prevent-500-on-error-during-addition branch March 11, 2022 12:48
zeripath added a commit to zeripath/gitea that referenced this pull request Mar 11, 2022
6543 pushed a commit that referenced this pull request Mar 13, 2022
… (#19059)

Backport #19041

Fix #19036

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the backport/done All backports for this PR have been created label Mar 19, 2022
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin Authentication Sources pages show 500 error in some causes
5 participants